﻿
namespace Service
{
    using Data.Repository;
    using System.Linq;
	using System.Collections.Generic;

    public class CountryService : ICountryService
    {
        private ICountryRepository _countryRepository;

        #region ICountryService Members

        /// <summary>
        /// create new country
        /// </summary>
        /// <param name="theNewCountry">the new country instance</param>
        /// <returns>the new country's ID</returns>
        public int CreateNewCountry(Data.Entity.Country theNewCountry)
        {
            if (theNewCountry == null)
            {
                return 0;
            }

            if (_countryRepository == null)
            {
                _countryRepository = new CountryRepository();
            }

            return _countryRepository.CreateNewCountry(theNewCountry);
        }

        public IList<Data.Entity.Country> GetAllCountry()
        {
            if (_countryRepository == null)
            {
                _countryRepository = new CountryRepository();
            }

            return _countryRepository.GetAllCountry();
        }

		//public Data.Entity.Country GetAllCountry()
		//{
		//    if(id <= 0)
		//    {
		//        return null;
		//    }

		//    if(_countryRepository == null)
		//    {
		//        _countryRepository = new CountryRepository();
		//    }

		//    return _countryRepository.GetTheCountry(id);
		//}

		#endregion
	}
}
